Add domain to ENR and correct checking#164
Conversation
dknopik
commented
Feb 28, 2025
- Put our domaintype into the ENR so that we can be discovered
- The domaintype is stored as four bytes, not as string. Fixes parsing
| ); | ||
| false | ||
| } | ||
| if let Some(Ok(domain_type)) = enr.get_decodable::<[u8; 4]>("domaintype") { |
There was a problem hiding this comment.
Could we handle the else case?
There was a problem hiding this comment.
What do you mean? There is an else below. If the field can not decoded, the enr is not acceptable.
There was a problem hiding this comment.
Sorry, I should have been clearer. We don't log if there's an error when decoding.
It was like that before but we also don't log if the field doesn't exist. Maybe we should if it's expected to always exist at this point.
There was a problem hiding this comment.
It's not expected to always exist. For example, non-SSV ENRs might arrive at this point, and they won't have this field. I will add a trace log for debugging anyway. Thanks!
There was a problem hiding this comment.
I think this should avoid non-ssv nodes https://github.com/sigp/anchor/blob/unstable/anchor/network/src/discovery.rs#L100